package clang.ir;

import fixedpoint.DataflowException;

public class ChangeSign extends Operator {

    public ChangeSign() {
        child = new Node[1];
    }

    @Override
    public String getRuntimeExpression() throws DataflowException {
        String s = child[0].getRuntimeValueWithWrap();

        // Do force cast, to avoid:
        // Warning C4146: unary minus operator applied to unsigned type, result still unsigned
        s = wrap(wrap(datatype.toString()) + s);

        s = "-" + s;
        return s;
    }
}
